package edu.hm.webengineer.meetagain.client;

import sun.net.www.content.text.plain;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.PasswordTextBox;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;

public class HeaderView extends FlowPanel {

	private SimplePanel pHeadline = new SimplePanel();
	private Label lHeadline = new Label("meet again");
	
	private FlowPanel pLogin = new FlowPanel();
	private Label lEmail = new Label("Email:");
	private TextBox tbEmail = new TextBox();
	private Label lPassword = new Label("Passwort:");
	private PasswordTextBox tbPassword = new PasswordTextBox();
	
	private Button bLogin = new Button("Anmelden");
	
	
	public HeaderView() {
		pHeadline.add(lHeadline);
		pHeadline.setStyleName(Const.STYLE_HEADLINE_DIV);
		add(pHeadline);
		
		
		addWithWrapedDiv(pLogin, lEmail, Const.SYTLE_LOGIN_LABEL_EMAIL);
		addWithWrapedDiv(pLogin, tbEmail, Const.SYTLE_LOGIN_TEXTBOX_EMAIL);
		addWithWrapedDiv(pLogin, lPassword, Const.SYTLE_LOGIN_LABEL_PASSWORD);
		addWithWrapedDiv(pLogin, tbPassword, Const.SYTLE_LOGIN_TEXTBOX_PASSWORD);
		addWithWrapedDiv(pLogin, bLogin, Const.SYTLE_LOGIN_BUTTON_LOGIN);
		pLogin.setStyleName(Const.STYLE_LOGIN_DIV);
		add(pLogin);
		//addWithWrapedDiv(this, pLogin, Const.STYLE_LOGIN_DIV);
	}
	
	private void addWithWrapedDiv(Panel container, Widget widget, String style) {
		SimplePanel panel = new SimplePanel();
		if (style != null) {
			panel.addStyleName(style);
		}
		panel.add(widget);
		container.add(panel);
	}
	
	
}
